Checks What page your on and checks if your allowed to access that page. There are 3 options but you can add more: Allowed, Deny, Redirect.

Just Copy and Paste this Code and change the file names in the array!



<?php
//The permission.php Page

function permission($page){


$permission = array(

    if (isset($_SESSION['USERID'])){

       "dashboard.php"=>"Allowed",
       "index.php"=>"Allowed",




       );

     }
     else
     {

 //If the User isn't Logged In!
      //Just Copy What up there in here but change the permission: Allowed, Deny, Redirect       

     }



   if ($permission[$page] == 'Redirect')
       header('Location: index.php');
   else
    if ($permission[$page] == 'Allowed')
      return;
     else
       if($permission[$page] == 'Deny')
         header('Location: deny.php');


}


?>


<?php

//The index.php 

include('permission.php');




permission('index.php');//The parameter is the file name.


//The rest of your Site Goes Here!....@@@

?>